/*
 *  WordData.h
 *  MemWorld
 *
 *  Created by 付卓 on 5/29/11.
 *  Copyright 2011 com.fuzhuo.soft. All rights reserved.
 *
 */
#ifndef __WORDDATA_H_
#define __WORDDATA_H_

#include<iostream>
#include<string>
#include<sstream>

#include<qstring.h>
#include<qfile.h>
#include<qtextstream.h>
#include "PYDB.h"

using namespace std;

class Word
{
public:
	int index;
	QString name;
	int value;
	void setValue(int index,QString name,int value);
};


class WordData
{
public:
	WordData(QString dbName);
	~WordData();
private://定义的一些宏
	QString dbName;/* 这个决定了使用哪个数据库和数据文件 */
	QString dataName;/* 这个决定了使用哪个数据库和数据文件 */
	static const int ORI = -1;
	static const int MAX =  31;
	static const int STEP0 =0;
	static const int STEP1 =1;
	static const int STEP2 =3;
	static const int STEP3 =7;
	static const int STEP4 =9;
	static const int STEP5 =30;
public:
	static const int TOTAL = 2065;
	int memword;
	int tmpmax;
	int tmptotal;
	int theNextIndex;
	
public:
	static const int MEM = -2;
	Word *words;
	Word *tmpwords;
	void initialWord();//初始化单词
	void changeWord(bool right);//切换单词序号，核心算法！！！
	Word getNext(int i);//获得第i个单词
	string printIndex();//打印序列
	
	PYDB *cetdb;//单词数据库文件
	void saveWords();//纪录退出时状态
	bool loadWords();//加载纪录的单词
};

#endif//__WORDDATA_H_

